package cn.wolfcode.trip.base.mapper;

import cn.wolfcode.trip.base.domain.User;
import cn.wolfcode.trip.base.query.QueryObject;
import cn.wolfcode.trip.base.query.UserFansQuery;
import org.apache.ibatis.annotations.Param;

import java.util.HashMap;
import java.util.List;
import java.util.Map;

public interface UserMapper {
    int deleteByPrimaryKey(Long id);

    int insert(User record);

    User selectByPrimaryKey(Long id);

    List<User> selectAll();

    List<User> selectForList(QueryObject qo);
    int updateByPrimaryKey(User record);

    /**
     * 注册和登录用同一个方法
     * @return
     */
    User queryForEmailAndPassword(@Param("email") String email, @Param("password") String password);

    User getUserByAuthorId(Long authorId);

    void userFansAndFollow(User user);

    HashMap selectFanByUserId(@Param("userId") Long userId , @Param("fanId") Long fanId);

    int insertFans(@Param("userId") Long userId, @Param("fanId") Long fanId);

    void deleteRelation(@Param("userId") Long userId, @Param("fanId") Long fanId);
    /**
     * 修改商城积分
     * @return
     */
    int updateIntegral(User record);


    void saveLike(@Param("userId") Long userId, @Param("travelId") Long travelId, @Param("authorId") Long authorId);

    HashMap selectLike(@Param("userId") Long userId, @Param("travelId") Long travelId);

    void deleteLike(@Param("userId") Long userId, @Param("travelId") Long travelId);

    List<User> selectAllFansOrfollows(UserFansQuery qo);
}